//package com.dh.jwt.config;
//
//import java.nio.charset.Charset;
//import java.util.ArrayList;
//import java.util.List;
//
//import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
//import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
//import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.http.MediaType;
//
//import com.alibaba.fastjson.serializer.SerializerFeature;
//import com.alibaba.fastjson.serializer.ValueFilter;
//import com.alibaba.fastjson.support.config.FastJsonConfig;
//import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter4;
//import com.dh.jwt.auth.WithSignMessageConverter;
//
///**
// * @author 作者 dinghao
// * @version 创建时间：2018年11月30日 上午10:17:06
// * @Description 类说明 : fastjson配置类
// */
//@Configuration("defaultFastjsonConfig")
//@ConditionalOnClass(com.alibaba.fastjson.JSON.class)
//@ConditionalOnMissingBean(FastJsonHttpMessageConverter4.class)
//@ConditionalOnWebApplication
//public class DefaultFastjsonConfig {
//
//	@Bean
//	public FastJsonHttpMessageConverter4 fastJsonHttpMessageConverter() {
//		FastJsonHttpMessageConverter4 converter = new WithSignMessageConverter();
//		converter.setFastJsonConfig(fastjsonConfig());
//		converter.setSupportedMediaTypes(getSupportedMediaType());
//		return converter;
//	}
//
//	/**
//	 * fastjson的配置
//	 */
//	public FastJsonConfig fastjsonConfig() {
//		FastJsonConfig fastJsonConfig = new FastJsonConfig();
//		fastJsonConfig.setSerializerFeatures(SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue);
//		fastJsonConfig.setDateFormat("yyyy-MM-dd HH:mm:ss");
//		ValueFilter valueFilter = new ValueFilter() {
//			public Object process(Object o, String s, Object o1) {
//				if (null == o1) {
//					o1 = "";
//				}
//				return o1;
//			}
//		};
//		fastJsonConfig.setCharset(Charset.forName("utf-8"));
//		fastJsonConfig.setSerializeFilters(valueFilter);
//		return fastJsonConfig;
//	}
//
//	/**
//	 * 支持的mediaType类型
//	 */
//	public List<MediaType> getSupportedMediaType() {
//		ArrayList<MediaType> mediaTypes = new ArrayList<>();
//		mediaTypes.add(MediaType.APPLICATION_JSON_UTF8);
//		return mediaTypes;
//	}
//
//}
